<template>
	<view>
		<view class="" style="padding: 50rpx 0 0 0 ;">
			<!-- <input type="text" v-model="verificationCodeStr"> -->
			 <u--input
			    placeholder="请输入核销码"
			    border="surround"
			    v-model="verificationCodeStr"
			  ></u--input>
		</view>
		<view class="" style="margin: 50rpx 0;">
			<u-button type="primary" @tap="scanCode" text="扫码核销"></u-button>
		</view>
		<view class="">
			<u-button type="primary" @tap="subimt" text="确定核销"></u-button>
		</view>
		
	</view>
</template>

<script>
	import {verificationOrder} from '../../../utils/api.js'
	export default {
		data() {
			return {
				verificationCodeStr:''
			}
		},
		methods: {
				scanCode() {
								// 允许从相机和相册扫码
								uni.scanCode({
									scanType: ["qrCode"],
									success: (res) => {
										console.log(res);
										if (res.result) {
											this.verificationCodeStr = res.result;
										} else {
											console.log('请重新扫描');
											return false;
										}
									},
									fail: (res) => {
										console.log('未识别到二维码');
									}
								})
							},
				
			subimt(){
				if(this.verificationCodeStr==''){
					uni.showToast({
						icon:'none',
						title:'核销码不能为空'
					})
					return
				}
				let data={
					verificationCodeStr:this.verificationCodeStr
				}
				verificationOrder(data).then(res=>{
					if(res.code==200){
						
					}
				})
			}
		}
	}
</script>

<style lang="scss">
page {
	padding: 20rpx;
	box-sizing: border-box;
}
</style>
